package yydy.pattern.structure.proxy.example;

import yydy.pattern.common.interfaces.Image;

/**
 * @author LY
 * @description: TODO
 * @title: ProxyImage
 * @projectName yydy_learn
 * @date 2020/11/4
 */
public class ProxyImage implements Image {

    private RealImage realImage;
    private String fileName;

    public ProxyImage(String fileName){
        this.fileName = fileName;
    }

    @Override
    public void display() {
        if(realImage == null){
            realImage = new RealImage(fileName);
        }
        realImage.display();
    }
}
